< previous page page_695 next page >

Page 695
The code in Listing 18.1 sets up the initial caption and textbox on the form and then forces the textbox to fill the entire frmMsgs form space. This form displays progress messages reported by the main data-entry form. You can save and close this form. This is all the code you need to add to the frmMsgs form.
Now open the main data-entry form (frmDataEntry) and add the code from Listing 18.2 to the Form_Load event of the form.
Type.gifListing 18.2. Coding the Form_Load event of the frmDataEntry form.
Private Sub Form_Load()
    '
    ' project setup actions
    '
    frmMsgs.Show ' launch message window
    '
    ' set up RDC
    MSRDC1.DataSourceName = "RDC Books5"
    MSRDC1.SQL = "SELECT * FROM Authors"
    MSRDC1.CursorDriver = rdUseClientBatch
    MSRDC1.LockType = rdConcurBatch
    MSRDC1.ResultsetType = rdOpenStatic
    MSRDC1.Refresh
    '
    ' bind inputs to rdc
    lblAUID.DataField = "AUID"
    txtName.DataField = "Name"
    txtDOB.DataField = "DOB"
    '
    ' set form title
    Me.Caption = "Remote Data Control Demo"
    '
End Sub
The code in Listing 18.2 sets up the basic parameters to the RDC, uses the Refresh method to fetch the data, and then updates the DataField properties of the bound input controls in order to link them to the dataset returned in the RDC. Note that you are using the rdOpenStatic option to create an updatable, fixed-membership dataset.
Now add the code from Listing 18.3 to the cmdBtn_Click event of the form. This single set of code handles all the command buttons, because the buttons were added as a control array.

 
< previous page page_695 next page >

If you like this book, buy it!